package fab.forms.error 
{
	/**
	 * ...
	 * @author fab
	 */
	public class ServerError
	{
		//static public const PHONENUMBER:String = "phonenumber";
		//static public const EMAIL:String = "email";
		//static public const NONEMPTY:String = "nonempty";
		//static public const CHECKED:String = "checked";
		static public var errors:Vector.<ServerError> = new Vector.<ServerError>();
		public var type:String;
		public var id:String;
		public var message:String;
		
		public function ServerError( _id:String,  _type:String, _message:String ="") 
		{
			id = _id;
			type = _type;
			message = _message;
			errors.push( this );
		}
		public function toString() : String
		{
			return "ServerError : " + type + "\t" + id + "\t" + message ; 
		}
		static public function getById(id:String) : ServerError
		{
			for each ( var err:ServerError in errors ) if ( err.id == id ) return err;
			return null;
		}
	}

}